package coml.jiyun.hp.reviewtopic.model;

import coml.jiyun.hp.reviewtopic.base.BaseModel;
import coml.jiyun.hp.reviewtopic.bean.HomeBean;
import coml.jiyun.hp.reviewtopic.net.HttpUtil;
import coml.jiyun.hp.reviewtopic.net.ResultCallBack;
import coml.jiyun.hp.reviewtopic.net.ResultSubscriber;
import coml.jiyun.hp.reviewtopic.net.RxUtils;

public class HomeModel extends BaseModel {
    public void getHome(final ResultCallBack<HomeBean>callBack){
        addDisposable(HttpUtil
            .getInstance()
            .getHomeServer()
            .getHome()
            .compose(RxUtils.<HomeBean>rxSchedulerHelper())
            .subscribeWith(new ResultSubscriber<HomeBean>() {
                @Override
                public void onNext(HomeBean homeBean) {
                    callBack.onSuccess(homeBean);
                }
            }));
    }
}